﻿using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.AUTO.Adjust.Dto;
using NP.BPMReportPlatform.AUTO.Quotation.Dto;
using NP.BPMReportPlatform.AUTO.TechnicalDependence.Dto;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.AUTO
{
    /// <summary>
    /// AUTO接口
    /// </summary>
    [Authorize]
    [ApiController]
    [Route("api/auto")]
    public class AUTOController : BPMReportPlatformController
    {
        private readonly IAUTOAppService _autoService;

        public AUTOController(IAUTOAppService autoService)
        {
            _autoService = autoService;
        }

        /// <summary>
        /// 样品单流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("SampleList/GetAllAsync")]
        public async Task<PagedResultDto<GetSampleListOutput>> GetAllAsync([FromBody] GetSampleListInput input)
        {
            return await _autoService.GetAllAsync(input);
        }

        /// <summary>
        ///  样品单流程  导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("SampleList/ExportAsync")]
        public async Task<XlsxFileResult<GetSampleListOutput>> ExportAsync([FromBody] GetSampleListInput input)
        {
            var rst = await _autoService.ExportAsync(input);
            return new XlsxFileResult<GetSampleListOutput>(rst, "导出Excel");
        }

        /// <summary>
        ///CPU报价审批流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("CPUQuotation/GetAllAsync")]
        public async Task<PagedResultDto<CPUQuotationOutput>> GetAllAsync([FromBody] GetCPUQuotationInput input)
        {
            return await _autoService.GetAllAsync(input);
        }

        /// <summary>
        ///KG报价审批流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("KGQuotation/GetAllAsync")]
        public async Task<PagedResultDto<KGQuotationOutput>> GetAllAsync([FromBody] GetKGQuotationInput input)
        {
            return await _autoService.GetAllAsync(input);
        }

        /// <summary>
        /// KG报价审批流程 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("KGQuotation/ExportAsync")]
        public async Task<XlsxFileResult<ExportKGQuotationOutput>> ExportAsync([FromBody] GetKGQuotationInput input)
        {
            var rst = await _autoService.ExportAsync(input);
            return new XlsxFileResult<ExportKGQuotationOutput>(rst, "导出Excel");
        }

        /// <summary>
        ///KG调价审批流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("KGAdjust/GetAllAsync")]
        public async Task<PagedResultDto<KGAdjustOutput>> GetAllAsync([FromBody] GetKGAdjustInput input)
        {
            return await _autoService.GetAllAsync(input);
        }

        /// <summary>
        /// KG调价审批流程 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("KGAdjust/ExportAsync")]
        public async Task<XlsxFileResult<ExportKGAdjustOutput>> ExportAsync([FromBody] GetKGAdjustInput input)
        {
            var rst = await _autoService.ExportAsync(input);
            return new XlsxFileResult<ExportKGAdjustOutput>(rst, "导出Excel");
        }

        /// <summary>
        ///CPU调价审批流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("CPUAdjust/GetAllAsync")]
        public async Task<PagedResultDto<CPUAdjustOutput>> GetAllAsync([FromBody] GetCPUAdjustInput input)
        {
            return await _autoService.GetAllAsync(input);
        }

        /// <summary>
        ///CPU调价审批流程 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("CPUAdjust/ExportAsync")]
        public async Task<XlsxFileResult<CPUAdjustOutput>> ExportAsync([FromBody] GetCPUAdjustInput input)
        {
            var rst = await _autoService.ExportAsync(input);
            return new XlsxFileResult<CPUAdjustOutput>(rst, "导出Excel");
        }

        /// <summary>
        ///销售技术依赖书流程 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("TechnicalDependence/GetAllAsync")]
        public async Task<PagedResultDto<TechnicalDependenceOutput>> GetAllAsync([FromBody] TechnicalDependenceInput input)
        {
            return await _autoService.GetAllAsync(input);
        }
        /// <summary>
        /// 销售技术依赖书流程 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("TechnicalDependence/Type1/ExportAsync")]
        public async Task<XlsxFileResult<ExportTD1Output>> Export1Async([FromBody] TechnicalDependenceInput input)
        {
            var rst = await _autoService.Export1Async(input);
            return new XlsxFileResult<ExportTD1Output>(rst, "导出Excel");
        }
        /// <summary>
        /// 销售技术依赖书流程 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("TechnicalDependence/Type2/ExportAsync")]
        public async Task<XlsxFileResult<ExportTD2Output>> Export2Async([FromBody] TechnicalDependenceInput input)
        {
            var rst = await _autoService.Export2Async(input);
            return new XlsxFileResult<ExportTD2Output>(rst, "导出Excel");
        }
        /// <summary>
        /// 销售技术依赖书流程 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("TechnicalDependence/Type3/ExportAsync")]
        public async Task<XlsxFileResult<ExportTD3Output>> Export3Async([FromBody] TechnicalDependenceInput input)
        {
            var rst = await _autoService.Export3Async(input);
            return new XlsxFileResult<ExportTD3Output>(rst, "导出Excel");
        }
    }
}